package com.jingdun.sport.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jingdun.sport.bean.model.RoomQuestionRelation;
import com.jingdun.sport.dao.RoomQuestionRelationMapper;
import com.jingdun.sport.service.RoomQuestionRelationService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
@Slf4j
@AllArgsConstructor
public class RoomQuestionRelationServiceImpl extends ServiceImpl<RoomQuestionRelationMapper, RoomQuestionRelation> implements RoomQuestionRelationService {

    private RoomQuestionRelationMapper roomQuestionRelationMapper;	
	
    public void addRoomQuestionRelation(RoomQuestionRelation roomQuestionRelation){
        roomQuestionRelationMapper.addRoomQuestionRelation(roomQuestionRelation);
    }

    public List<RoomQuestionRelation> getRoomQuestionRelationDetail(@Param("params") Map<String, Object> m){
        return roomQuestionRelationMapper.getRoomQuestionRelationDetail(m);
    }
	
	public Page<Map<String, Object>> getPaginationRoomQuestionRelation(@Param("params") Map<String, Object> m){
        //新建分页
        Page<Map<String,Object>> page =new Page<Map<String,Object>>((long)m.get("current"), (long)m.get("size"));
        //返回结果
        page.setRecords(this.baseMapper.getPaginationRoomQuestionRelation(page, m));
        return page;
    }

    public void updateRoomQuestionRelation(RoomQuestionRelation roomQuestionRelation){
        roomQuestionRelationMapper.updateRoomQuestionRelation(roomQuestionRelation);
    }

}
